import request from '../utils/request'

//获取是否教师的标志
export function getLiveLession(): any {
  return request({
    url: '/user/getLiveLession',
    method: 'get'
  })
}

//获取是否教师的标志
export function isTeacher(): any {
  return request({
    url: '/user/isTeacher',
    method: 'get'
  })
}

//获取是否是我的课程
export function isMyCourse(query: any): any {
  return request({
    url: '/user/isTeacherCourse',
    method: 'get',
    params: query,
  })
}

//获取用户课程列表
export function getMyCourseList(): any {
  return request({
    url: '/user/getMyCourseList',
    method: 'get'
  })
}
//获取所有用户课程列表
export function getAllCourseList(data: any): any {
  return request({
    url: '/user/getAllCourseList',
    method: 'post',
    data,
  })
}
//获取学年
export function getSchoolYear(): any {
  return request({
    url: '/user/getSchoolYear',
    method: 'get'
  })
}
// 删除课程
export function deleteCourse(data: any): any {
  return request({
    url: '/user/deleteCourse',
    method: 'post',
    data,
  })
}

export function updateCourseLive(data: any): any {
  return request({
    url: '/user/updateCourseLive',
    method: 'post',
    data,
  })
}
// 保存课程
export function saveCourse(data: any): any {
  return request({
    url: '/user/saveCourse',
    method: 'post',
    data,
  })
}
export function uploadImage(data: any): any {
  return request({
    url: '/user/upload',
    method: 'post',
    data,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
    // 'content-type': "multipart/form-data",
    // headers: {
    //   'Content-Type': "multipart/form-data",
    // }
  })
}

export function download(query: any): any {
  return request({
    url: '/user/download',
    method: 'get',
    params: query,
    responseType: "blob",
  })
}

// export const download = params => {
//   return service({
//     baseURL,
//     url: `/user/download`,
//     method: "post",
//     data: params,
//     responseType: "blob",
//   });
// };

